package org.example.xiaomi.dao.impl;

import org.example.xiaomi.dao.UserDao;
import org.example.xiaomi.entity.User;
import org.example.xiaomi.tx.TransactionManager;

public class Sql2oUserDaoImpl implements UserDao {
    @Override
    public User findUserByName(String username) {
        return TransactionManager.getConnection().createQuery("select * from user where username=:username")
                .addParameter("username", username)
                .executeAndFetchFirst(User.class);
    }
}
